<template>
  <van-tabs v-model:active="active">
    <van-tab v-for="item in list" :key="item.id" :title="item.text">
      <!-- 轮播图组件 -->
      <HomeSwipe />
      <!-- 视频列表 -->
      <HomeVideoList :id="item.id"/>
    </van-tab>
  </van-tabs>
</template>

<script setup lang="ts">
import { ref } from 'vue'
import axios from 'axios'
import HomeSwipe from './home-swipe.vue'
import HomeVideoList from './home-video-list.vue'
interface INavItem {
  id: string
  text: string
}

const active = ref(0)

const list = ref<INavItem[]>([])

axios({
  url: '/navList',
  method: 'get'
}).then(res => {
  list.value = res.data.result
})
</script>
